# Python继承机制及其使用
'''
class 类名(父类1, 父类2, 父类3...):
    # 类定义部分
'''
class Shape:
    def draw(self, content):
        print("画", content)

class Form(Shape):
    def area(self):
        # ...
        print("此图形的面积为...")

class People:
    def say(self):
        print("我是一个人，名字是：", self.name)

class Animal:
    def display(self):
        print("人也是高级动物")

# 同时继承 People 和 Animal 类
# 其同时拥有 name 属性、say() 和 display() 方法
class Person(People, Animal):
    pass

zhangsan = Person()
zhangsan.name = "张三"
zhangsan.say()
zhangsan.display()
print()

class People:
    def __init__(self):
        self.name = People
    def say(self):
        print("People类", self.name)

class Animal:
    def __init__(self):
        self.name = Animal
    
    def say(self):
        print("Animal类", self.name)

# People 中的 name 属性和 say() 会遮蔽 Animal 类中的
class Person(People, Animal):
    pass

zhangsan = Person()
zhangsan.name = "张三"
zhangsan.say()
print()
